package com.happyclub.lbjcontroller;

import com.happyclub.lbj.service.IActivityCommont;
import com.happyclub.lbj.service.IActivityCommontReply;
import com.happyclub.pojo.TbActivityCommont;
import com.happyclub.pojo.TbActivityCommontReply;
import com.happyclub.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * @author 高欢
 * @description TODO
 * @date 2019/4/8
 */
@RestController
@RequestMapping("/activityCommont")
public class ActivityCommontController {
    @Autowired
    IActivityCommont iActivityCommont;

    @Autowired
    IActivityCommontReply iActivityCommontReply;

    @RequestMapping(value = "/saveActivityCommont",method = RequestMethod.POST)
    public JsonResult saveActivityCommont(@RequestBody TbActivityCommont activityCommont){
        return iActivityCommont.saveActivityCommont(activityCommont);
    }

    @RequestMapping(value = "/delActivityCommont/{id}",method = RequestMethod.DELETE)
    public JsonResult delActivityCommont(@PathVariable String id){
        return iActivityCommont.delActivityCommont(id);
    }
    //============================//
    @RequestMapping(value = "/saveActivityCommontReply",method = RequestMethod.POST)
    public JsonResult saveActivityCommontReply(@RequestBody TbActivityCommontReply activityCommontReply){
        return iActivityCommontReply.saveActivityCommontReply(activityCommontReply);
    }

    @RequestMapping(value = "/delActivityCommontReply",method = RequestMethod.DELETE)
    public JsonResult delActivityCommontReply(@PathVariable String id){
        return iActivityCommontReply.delActivityCommontReply(id);
    }

    //点进活动,展示该活动下的对活动的评论
    @RequestMapping(value = "/findActCommByActId/{id}",method = RequestMethod.GET)
    public JsonResult findActivityCommontByActivityId(@PathVariable String id){
        return iActivityCommont.findAllActivityCommontById(id);
    }

    //点击查看该评论下的回复,获取该评论的ID 传入
    @RequestMapping(value = "/findActivityCommontReply/{commontId}",method = RequestMethod.GET)
    public JsonResult findActivityCommontReply(@PathVariable String commontId){
        return iActivityCommontReply.findCommontReplyByCommontId(commontId);
    }
}
